package dto

import (
	"gitee.com/song-yao-shun/MQH/model"
)

//// 定义转换函数
//func ToDto(applications []model.Application, appList vo.ApplicationList) (result []map[string]interface{}) {
//
//	// 获取需要返回的field
//	for k := 0; k < len(applications); k++ {
//		res := make(map[string]interface{})
//		for _, field := range strings.Split(appList.SelectField, ",") {
//			log.Println(reflect.ValueOf(applications[k]).FieldByName(field))
//			res[field] = reflect.ValueOf(applications[k]).FieldByName(field)
//		}
//		result = append(result, res)
//	}
//	log.Println(result)
//	return
//}

type AppDto struct {
	ID int `json:"id"`
	Name string `json:"name"`
}

// 定义转换函数
func ToAppDto(applications []model.Application) (result []AppDto){

	for i :=0; i < len(applications); i++{
		res := AppDto{
			ID:		applications[i].ID,
			Name: 	applications[i].Name,
		}
		result = append(result,res)
	}
	return
}